home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 116 / MacAddict 116 (Mac Power Pack)(theDISC)(April 2006).iso / Software / Internet & Communication / Jon's Phone Tool.dmg / Goodies / JPT Script Examples.applescript next >
Text File  |  2005-12-18  |  13KB  |  203 lines

  1. tell application "Jon's Phone Tool"
  2.     --get the current location:
  3.     set current_location to current location
  4.     
  5.     --to get all locations, use the command "list locations":
  6.     set all_locations to list locations
  7.     
  8.     --to set a location, make sure you are using a location that exists from the "list locations" command
  9.     set the_location to "Office"
  10.     if the_location is in (list locations) then set current location to the_location
  11.     
  12.     --get the current location settings:
  13.     set current_location_settings to current location settings
  14.     
  15.     --to set the current location settings, you use a record of one or more of the location settings
  16.     --to set the call type Dial Methods, the Dial Method must be one of the following constants:
  17.     --{Speaker, Modem, Bluetooth Phone, Asterisk, CallVantage, Cisco IP Phone, Phlink, PhoneValet, Skype, URL, Vonage, Xten Softphone}
  18.     --Note: if you try to set the Dial Method to a Method that is not available on your system,
  19.     --the set command will have no effect 
  20.     
  21.     --so, here are settings appropriate for New York City:    
  22.     set current location settings to {preprocess number script:"", country:"United States", local country code:"+1", outside prefix enabled:false, outside prefix:"9,", call waiting prefix:"*70,", caller ID block prefix:"*82,", literal Dial Method:Speaker, maximum internal length:4, internal prefix:"", internal suffix:"", internal Dial Method:Speaker, maximum local length:7, local area codes:"212, 718, 917, 646", include local area code:true, local prefix:"1", local suffix:"", local Dial Method:Modem, domestic prefix:"1", domestic suffix:"", domestic Dial Method:Speaker, international delimiter:"+", include international delimiter:false, international prefix:"011", international suffix:"", international Dial Method:Speaker, toll free codes:"800, 866, 877, 888", toll free prefix:"1", toll free suffix:"", toll free Dial Method:Speaker, SIP Dial Method:URL}
  23.     
  24.     --here are settings appropriate for using SkypeOut in the US:    
  25.     set current location settings to {preprocess number script:"", country:"Custom", local country code:"", outside prefix enabled:false, outside prefix:"", call waiting prefix:"", caller ID block prefix:"", literal Dial Method:Skype, maximum internal length:4, internal prefix:"", internal suffix:"", internal Dial Method:Skype, maximum local length:7, local area codes:"", include local area code:true, local prefix:"+1", local suffix:"", local Dial Method:Skype, domestic prefix:"+1", domestic suffix:"", domestic Dial Method:Skype, international delimiter:"+", include international delimiter:false, international prefix:"", international suffix:"", international Dial Method:Skype, toll free codes:"800, 866, 877, 888", toll free prefix:"+1", toll free suffix:"", toll free Dial Method:Skype, SIP Dial Method:URL}
  26.     
  27.     --get the current search site:
  28.     set current_search_site to current search site
  29.     
  30.     --to get all search sites, use the command "list search sites":
  31.     set all_search_sites to list search sites
  32.     
  33.     --to set a search site, make sure you are using a search site that exists from the "list search sites" command
  34.     set the_search_site to "Address Book"
  35.     if the_search_site is in (list search sites) then set current search site to the_search_site
  36.     
  37.     --to get all recently dialed numbers, use the command "list recently dialed numbers":
  38.     set recently_dialed_numbers to list recently dialed numbers
  39.     
  40.     --to get all Quick Dial Numbers, use the command "list Quick Dial Numbers":
  41.     set all_Quick_Dial_Numbers to list Quick Dial Numbers
  42.     
  43.     --to add a new Quick Dial Number, send the command "add Quick Dial" with the parameters "name" and "number" (both required):
  44.     add Quick Dial contact name "NYC Information" contact number "(212) 555-1212"
  45.     
  46.     --to get all available Dial Methods, use the command "list Dial Methods":
  47.     set all_Dial_Methods to list Dial Methods
  48.     
  49.     --get the speaker settings:
  50.     set speaker_settings to speaker settings
  51.     
  52.     --to set the speaker settings, you use a record of one or more of the speaker settings:
  53.     set speaker settings to {speaker dial speed:fast, speaker comma pause:1.5}
  54.     
  55.     --get the modem settings:
  56.     set modem_settings to modem settings
  57.     
  58.     --to set the modem settings, you use a record of one or more of the modem settings:
  59.     set modem settings to {device:"modem", init string:"AT&FS10=255", sound enabled:true, wait for dial tone:true, touchtones:true, hang up timeout:10, release on hang up:false, calling tones disabled:false, wait for response:true, redial on busy:false, redial on busy pause:1, redial on busy total attempts:5, call detection enabled:false, call detection rings:3, call detection alert enabled:false, call detection off hook enabled:false, external application on call detection:""}
  60.     
  61.     --get the Bluetooth phone settings:
  62.     set bluetooth_settings to Bluetooth phone settings
  63.     
  64.     --to set the Bluetooth settings, you use a record of one or more of the Bluetooth settings:
  65.     set Bluetooth phone settings to {device:"Bluetooth-Modem", init string:"AT&F", alternate mobile dial string:false}
  66.     
  67.     --get the Asterisk settings:
  68.     set asterisk_settings to Asterisk settings
  69.     
  70.     --to set the Asterisk settings, you use a record of one or more of the Asterisk settings:
  71.     set Asterisk settings to {Asterisk username:"", Asterisk password:"", Asterisk extension:"", Asterisk connected device type:SIP Phone or Adapter, Asterisk context:"", Asterisk caller ID:"", Asterisk verbose logging enabled:true, Asterisk local server:false, Asterisk remote IP:"127.0.0.1", Asterisk remote server port:5038}
  72.     
  73.     --get the CallVantage settings:
  74.     set callvantage_settings to CallVantage settings
  75.     
  76.     --to set the CallVantage settings, you use a record of one or more of the CallVantage settings:
  77.     set CallVantage settings to {CallVantage number:"2125551212", CallVantage password:""}
  78.     
  79.     
  80.     --get the Cisco IP Phone settings:
  81.     set cisco_settings to Cisco IP Phone settings
  82.     
  83.     --to set the Cisco IP Phone settings, you use a record of one or more of the Cisco settings:
  84.     set Cisco IP Phone settings to {Cisco username:"", Cisco password:"", Cisco IP address:"192.168.0.100", Cisco priority:0}
  85.     
  86.     --get the Phlink settings (you can return these even if Ovolab Phlink is not available on your system):
  87.     set phlink_settings to Phlink settings
  88.     
  89.     --to set the Phlink settings, you use a record of one or more of the Phlink settings:
  90.     set Phlink settings to {Phlink recording enabled:true, Phlink silence detection enabled:true, Phlink hang up timeout:10, Phlink remote:true, Phlink remote username:"", Phlink remote password:"", Phlink remote IP address:"192.168.0.100"}
  91.     
  92.     --get the PhoneValet settings (you can return these even if Parliant's PhoneValet is not available on your system):
  93.     set phonevalet_settings to PhoneValet settings
  94.     
  95.     --to set the PhoneValet settings, you use a record of one or more of the PhoneValet settings (well, there's currently only one setting):
  96.     set PhoneValet settings to {PhoneValet dial exact:true, PhoneValet remote:true, PhoneValet remote username:"", PhoneValet remote password:"", PhoneValet remote IP address:"192.168.0.100"}
  97.     
  98.     --get the URL settings
  99.     set url_settings to URL settings
  100.     
  101.     --to set the URL settings, you use a record of one or more of the URL settings:
  102.     set URL settings to {DM URL:"http://www.google.com/search?sa=X&oi=fwp&pb=f&q=%#", DM URL called silently:false, DM URL encoding:None}
  103.     
  104.     --get the Vonage settings:
  105.     set vonage_settings to Vonage settings
  106.     
  107.     --to set the Vonage settings, you use a record of one or more of the Vonage settings:
  108.     set Vonage settings to {Vonage username:"", Vonage password:"", Vonage number:""}
  109.     
  110.     --get the Xten softphone settings (you can return these even if no Xten softphone is available on your system):
  111.     set xten_settings to Xten softphone settings
  112.     
  113.     --to set the Xten softphone settings, you use a record of one or more of the Xten softphone settings:
  114.     set Xten softphone settings to {Xten strip formatting:true, Xten delay dial:15}
  115.     
  116.     --get the call timer settings:
  117.     set call_timer_settings to call timer settings
  118.     
  119.     --to set the call timer settings, you use a record of one or more of the call timer settings
  120.     --Note: "timer enabled" is a read-only property
  121.     --to start or stop a timer, use the "start timer" & "stop timer" commands
  122.     set call timer settings to {timer frequency:0.5, beep enabled:true, auto start:false, timer reset on start:true}
  123.     
  124.     --get the application preferences:
  125.     set application_preferences to {launch status window enabled:launch status window enabled, startup item enabled:startup item enabled, main window shows on launch:main window shows on launch, textures enabled:textures enabled, status window enabled:status window enabled, alternate main enabled:alternate main enabled, main opacity:main opacity, main shadow enabled:main shadow enabled, recents menu max:recents menu max, separate recently dialed numbers menu enabled:separate recently dialed numbers menu enabled, separate Quick Dial menu enabled:separate Quick Dial menu enabled, hide PIM on lookup:hide PIM on lookup, global hotkey enabled:global hotkey enabled, global hotkey:global hotkey, global hotkey use Control modifier:global hotkey use Control modifier, global hotkey use Option modifier:global hotkey use Option modifier, global hotkey use Shift modifier:global hotkey use Shift modifier, convert mnemonics on dial:convert mnemonics on dial, include clipboard extras:include clipboard extras, voice enabled:voice enabled, tool tips enabled:tool tips enabled, JPT shows in Dock enabled:JPT shows in Dock enabled, dial confirmation enabled:dial confirmation enabled, external application on dial:external application on dial, pause iTunes on dial:pause iTunes on dial, change iTunes volume on dial:change iTunes volume on dial, iTunes volume on dial:iTunes volume on dial, pause DVD Player on dial:pause DVD Player on dial, change iChat status on dial:change iChat status on dial, iChat status on dial:iChat status on dial}
  126.     
  127.     --to set the application preferences, set them individually. E.g.,:
  128.     set separate Quick Dial menu enabled to (not (separate Quick Dial menu enabled))
  129.     
  130.     --if you have your preferences set such that JPT pauses iTunes, DVD Player, or modifies your iChat status, you can rest these applications by issueing a "restore iApp status" command:
  131.     restore iApp status
  132.     
  133.     set the_number to "212-555-1212"
  134.     --to have the user enter the number, un-comment the next line:
  135.     --set the_number to text returned of (display dialog "What number shall I dial?" default answer the_number)
  136.     
  137.     --to grab the number from the clipboard, un-comment the next line:
  138.     --set the_number to (the clipboard)
  139.     
  140.     --to take the value from a cell in FMP, un-comment the following code:
  141.     (*
  142. property cell_name : ""
  143. repeat while cell_name = ""
  144.     set cell_name to text returned of (display dialog "What cell name should I use?" default answer cell_name)
  145. end repeat
  146. try
  147.     tell application "FileMaker Pro" to set the_number to cellValue of cell cell_name of current record of database 1
  148. on error the_error
  149.     beep
  150.     display dialog the_error buttons {"OK"} default button 1 with icon 0 giving up after 10
  151.     set cell_name to ""
  152.     return
  153. end try
  154. *)
  155.     
  156.     --to dial a number (make sure JPT's dialing parameters are properly set--see above):
  157.     dial number the_number
  158.     
  159.     --to dial a number and to set the name used in the dial log, use the optional "name" parameter: 
  160.     dial number the_number name "NYC Information" --with literal
  161.     
  162.     --if your number is already completely formatted with the appropriate prefixes and suffixes, you
  163.     --can tell JPT to dial the number exactly as formatted without adding any additional prefixes or
  164.     --suffixes that it would otherwise add by using the optional "literal" parameter.
  165.     --This does not change the configuration of JPT, for that set the current location settings as described above.
  166.     set the_number to "9,1-212-555-1212" --a completely formatted number
  167.     dial number the_number name "NYC Information" with literal
  168.     
  169.     --to lookup a name, you need to specify a search site, so let's get them all:
  170.     set all_search_sites to list search sites
  171.     
  172.     --now that you have the search sites, lookup someone:
  173.     set the_name to "Apple" -- string
  174.     set search_site to (item 1 of all_search_sites) -- string from fixed set of search sites
  175.     activate
  176.     lookup contact the_name search site search_site
  177.     
  178.     --to constrain the search to companies only, use the optional "companies only" parameter:
  179.     activate
  180.     lookup contact the_name search site search_site with companies only
  181.     
  182.     --to convert a mnemonic string to a phone number:
  183.     set the_mnemonic to "1-800-SOS-APPL" -- string
  184.     set converted_mnemonic to convert mnemonic the_mnemonic
  185.     
  186.     --to use the timer, you need to set a frequency and whether or not to use a beep:
  187.     set the_frequency to 0.5 -- real number as minutes, e.g., 0.5 = 30 seconds    
  188.     start timer frequency the_frequency with beep and reset
  189.     delay 41 --wait for the timer to fire once and the alert to dismiss itself then stop the timer
  190.     stop timer
  191.     
  192.     --you can also script the modem through JPT:
  193.     initialize modem using "AT&F"
  194.     take modem off hook
  195.     delay 10
  196.     put modem on hook
  197.     delay 10
  198.     take modem off hook
  199.     delay 10
  200.     hang up
  201.     release modem
  202.     
  203. end tell